package com.isoft.entity;

import lombok.Data;
import jakarta.xml.bind.annotation.*;

import java.util.List;

@Data
@XmlRootElement(name = "MSG")
@XmlAccessorType(XmlAccessType.FIELD)
public class DfmeAirlEntity {
    @XmlElement(name = "META")
    private Meta meta;
    @XmlElement(name = "DFLT")
    private Dflt dflt;

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Meta {
        @XmlElement(name = "SNDR")
        private String sender;
        @XmlElement(name = "RCVR")
        private String receiver;
        @XmlElement(name = "SEQN")
        private Long sequenceNumber;
        @XmlElement(name = "DDTM")
        private String dateTime;
        @XmlElement(name = "TYPE")
        private String type;
        @XmlElement(name = "STYP")
        private String subType;
        
        // 添加msgId字段用于自增主键
        private Long msgId;
        
        public Long getMsgId() {
            return msgId;
        }
        
        public void setMsgId(Long msgId) {
            this.msgId = msgId;
        }
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Dflt {
        @XmlElement(name = "FLID")
        private Long flightId;
        @XmlElement(name = "FIDE")
        private String flightIdentifier;
        @XmlElement(name = "FFID")
        private String flightFileId;
        @XmlElement(name = "FATT")
        private String flightAttribute;
        @XmlElement(name = "AIRL")
        private Airl airl;

        @Data
        @XmlAccessorType(XmlAccessType.FIELD)
        public static class Airl {
            @XmlElementWrapper(name = "AIRL")
            @XmlElement(name = "ARPT")
            private List<Arpt> arpts;
        }

        @Data
        @XmlAccessorType(XmlAccessType.FIELD)
        public static class Arpt {
            @XmlElement(name = "APNO")
            private Integer airportSeq;
            @XmlElement(name = "APCD")
            private String airportCode;
            @XmlElement(name = "FPTT")
            private String scheduledTime;
            @XmlElement(name = "FETT")
            private String estimatedTime;
            @XmlElement(name = "FRTT")
            private String actualTime;
            @XmlElement(name = "APAT")
            private String airportTerminal;
        }

        public Long getFlightId() { return flightId; }
        public void setFlightId(Long flightId) { this.flightId = flightId; }
        public Airl getAirl() { return airl; }
        public void setAirl(Airl airl) { this.airl = airl; }
    }

    public Meta getMeta() {
        return meta;
    }

    public void setMeta(Meta meta) {
        this.meta = meta;
    }

    public Dflt getDflt() {
        return dflt;
    }

    public void setDflt(Dflt dflt) {
        this.dflt = dflt;
    }
}